<!-- BEGIN PAGE HEADER-->
<?php $this->load->view('partials/breadcrumb.tpl', Array('_BTN_GROUP'=>array('url'=>site_url($thisModule.$thisController),  'class'=>'btn default', 'name'=>'返回列表', 'i'=>'<i class="m-icon-swapleft"></i>')))?>
<!-- END PAGE HEADER-->
<script type="text/javascript">
$(document).ready(function(){
	var amountInput = $("input[name='amount']");
	var percetSelect = $("select[name='percet']");
	var rechargeAmountInput = $("input[name='recharge_amount']");
	$(amountInput).blur(function(){
		
		$(this).val(parseFloat($(this).val()).toFixed(2));
		if($(percetSelect).val()){
    		var val = $(percetSelect).val();
    		var amount = parseFloat(amountInput.val());
    		var recharge_amount = parseFloat(amount+amount*(parseFloat(val))).toFixed(2);
    		$(rechargeAmountInput).val(recharge_amount);
		}else{
			$(rechargeAmountInput).val(amountInput.val());
		}
	});
	$(percetSelect).change(function(){
		if(!amountInput.val()){
			alert("请先填写‘数量’");
			$(amountInput).focus();
			$(this).val('');
			return;
		}
		var val = $(this).children('option:selected').val();
		var amount = parseFloat(amountInput.val());
		var recharge_amount = parseFloat(amount+amount*(parseFloat(val))).toFixed(2);
		if(val!=''){
			$(rechargeAmountInput).val(recharge_amount);
		}else{
			$(rechargeAmountInput).val(amount.toFixed(2));
		}
		
	});
});
</script>
<!-- BEGIN PAGE CONTENT-->
<div class="row">
	<div class="col-xs-12 ">
		<!-- BEGIN SAMPLE FORM PORTLET-->
		<div class="portlet box green ">
			<?=edit_form_caption(l($thisMethod).'自建订单')?>
			<div class="portlet-body form">
				<?=form_open('', Array('class'=>'form-horizontal', 'role'=>'form', 'id'=>'form_edit', 'data-category-id'=>$obj->id))?>
					<input type="hidden" id="update_time" name="update_time" value="<?=set_value('update_time', $obj->update_time)?>" />
					<div class="form-body">
						<?=edit_form_input('account', set_value('account', $obj->account), '用户账号')?>
						<?=edit_form_input('amount', set_value('amount', $obj->amount), '订单数量')?>
						<?=edit_form_dropdown('percet',array(''=>'请选择优惠比例','0.01'=>'1%','0.02'=>'2%','0.05'=>'5%','0.08'=>'8%'),set_value('percet',$obj->percet),'优惠比例')?>
						<?=edit_form_input('recharge_amount',set_value('recharge_amount',$obj->recharge_amount),'优惠后数量','readonly  unselectable="on"')?>
						<?=edit_form_input('bank_code', set_value('bank_code', $obj->bank_code), '自有通道编号')?>
						<?=edit_form_input('pay_transaction', set_value('pay_transaction', $obj->pay_transaction), '自有通道流水号')?>
						<?=edit_form_input('payer_name', set_value('payer_name', $obj->payer_name), '用户姓名')?>
						<?=edit_form_input('bank_account', set_value('bank_account', $obj->bank_account), '用户通道帐户')?>
						<?=edit_form_input('pay_time', set_value('pay_time', $obj->pay_time), '自有通道确认时间<br/>(格式：201805101530)')?>
						
					</div>
					<?php $this->load->view('partials/submitButtons.tpl')?>
				<?=form_close()?>
			</div>
		</div>
		<!-- END SAMPLE FORM PORTLET-->
		<!-- BEGIN SAMPLE FORM PORTLET-->
	</div>
</div>
<!-- END PAGE CONTENT-->
